Skip to content

[log] Add debug logging to jq middleware filter functions#6715

Merged
lpcox merged 1 commit into
mainfrom
log/jqschema-middleware-logging-33108b076c2771bf
May 30, 2026
Merged

[log] Add debug logging to jq middleware filter functions#6715
lpcox merged 1 commit into
mainfrom
log/jqschema-middleware-logging-33108b076c2771bf

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Adds logMiddleware.Printf calls to three functions in internal/middleware/jqschema.go that previously had no debug instrumentation:

Changes

  • CompileToolResponseFilter: logs filter expression length on entry, and confirms successful compilation on exit — useful for diagnosing filter parse/compile failures
  • tryApplyToolResponseFilter: logs the tool name, query ID, and whether a filter is active — helps distinguish between filtered and unfiltered tool call paths
  • rewriteFilteredTextPayload: logs the length of the filtered text being written back — provides visibility into the rewrite step when a tool response filter is applied

Why these functions?

These are key entry points in the tool response filter pipeline. The surrounding code (wrapToolHandler, savePayload, applyJqSchema) already has thorough logging, but these intermediate helpers were opaque when tracing filter-related issues under DEBUG=middleware:*.

Validation

  • make format build lint test-unit test-integration — all pass ✓
  • (Rust guard test skipped: network access to crates.io blocked in CI environment)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • index.crates.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "index.crates.io"

See Network Configuration for more information.

Generated by Go Logger Enhancement · sonnet46 14.2M ·

Add logMiddleware.Printf calls to CompileToolResponseFilter,
tryApplyToolResponseFilter, and rewriteFilteredTextPayload in
internal/middleware/jqschema.go. These functions previously had no
debug instrumentation despite being key entry points in the tool
response filter pipeline.

The new logs help trace:
- When a filter expression is compiled and its length (compile entry/exit)
- Whether a response filter is active per tool call (filter present/absent)
- Text payload rewrite size when filtered content is applied

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels May 30, 2026
@lpcox lpcox marked this pull request as ready for review May 30, 2026 13:30
Copilot AI review requested due to automatic review settings May 30, 2026 13:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds debug instrumentation to jq tool response filtering paths in internal/middleware/jqschema.go, improving traceability under DEBUG=middleware:* without changing filter behavior.

Changes:

  • Logs jq filter expression length before compilation and success after compilation.
  • Logs per-call filter presence with tool/query identifiers.
  • Logs filtered text length when rewriting the primary text payload.
Show a summary per file
File Description
internal/middleware/jqschema.go Adds debug logging to tool response filter compilation, application, and text payload rewrite helpers.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@lpcox lpcox merged commit 339fd05 into main May 30, 2026
23 checks passed
@lpcox lpcox deleted the log/jqschema-middleware-logging-33108b076c2771bf branch May 30, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants